﻿using System;
using NUnit.Framework;
using Moq;

namespace SolutionSorter.Core.Test
{
    [TestFixture]
    public class when_sorting_a_solution_file
    {
        Mock<IContentManager> contentManager;
        Mock<IContentSorter> sorter;
        SortManager sut;

        [Test]
        public void ProcessingSequenceIsValid()
        {            
            contentManager = new Mock<IContentManager>();
            sorter = new Mock<IContentSorter>();
            sut = new SortManager(contentManager.Object, sorter.Object);

            contentManager.Expect(x => x.GetContent()).Returns("theContent");
            sorter.Expect(x => x.SortContent(It.IsAny<string>())).Returns("theSortedContent");
            contentManager.Expect(x => x.SaveContent(It.Is<string>(s => s == "theSortedContent")));

            sut.SortSolutionFile();

            contentManager.VerifyAll();
            sorter.VerifyAll();
        }

    }
}
